﻿@using BonjourQuotation.UI.Models.CustomerModel
@model ManageCustomerPaymentsGridViewModel


@using (@Html.BeginForm("SaveCustomerPaymentsData", "Customer", FormMethod.Post, new { id = "LoadCustomerPaymentsForm", style = "height: 0px !important;" }))
{
    <div id="ErrorMessagesDivPopUp">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>
     @Html.HiddenFor(model => model.CustomerID)
     @Html.HiddenFor(model => model.SelectedLineNo)

    <div style="width: 941px; min-height: 60px; max-height: 120px; margin: auto; float: left; padding-bottom: 30px; margin-left: 9px; ">
        <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 920px;background-color:white;">
            <thead>
                <tr>
                    <th width="10%;" class="GridHeaders font12">Date</th>
                    <th width="30%;" class="GridHeaders font12">Type</th>
                    <th width="10%;" class="GridHeaders font12">RefundF</th>
                    <th width="30%;" class="GridHeaders font12">Description</th>
                    <th width="10%;" class="GridHeaders font12">Debit</th>
                    <th width="10%;" class="GridHeaders font12">Credit</th>
                </tr>
            </thead>
        </table>
        <div id="PaymentsGridlochal" style="height: 80px; overflow-y: auto;">
            <table class="table table-bordered table-hover table-condensed" style="width: 920px; table-layout: fixed; background-color: white;">
                <tbody>
                    @Html.HiddenFor(model => model.CustomerID, new { @id = "SearchCustomerID" })
                    @Html.HiddenFor(model => Model.Rows.Count, new { @id = "RowsCount" })
                    @for (int ind = 0; ind < Model.Rows.Count; ind++)
                    {
                        Model.SelectedPayTypeID = Model.Rows[ind].PayTypeID;
                        <tr id="@ind">
                            <td style="display:none">
                                @Html.HiddenFor(model => Model.Rows[ind].LineNo, new { @class = "LineNoForFindGroup" })
                            </td>
                            <td class="GroupDetailClik" width="10%;">@Html.TextBoxFor(model => model.Rows[ind].PaymentDate, new { @class = "table_inputs_82 table_inputs_WithoutBox CustomerDeteilsDataCalendar FSizeForGroupTable GroupDetailClik CustomerPaymentsChange ElementsForValidation Date Required", @style = "cursor:pointer" })</td>
                            <td class="GroupDetailClik" width="30%;">
                                @Html.DropDownListFor(model => Model.SelectedPayTypeID, new SelectList(Model.PaymentTypes, "Value", "Text"), new { @class = "table_inputs_266 table_inputs_WithoutBox FSizeForGroupTable PaymentDrop CustomerPaymentsChange GroupDetailClik" })
                                @Html.DropDownListFor(model => Model.Rows[ind].PayTypeID, new SelectList(Model.PaymentTypes, "Value", "Text"), new { @class = "RoomGridDropHide" })
                            </td>
                            <td class="GroupDetailClik " width="10%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].RefundF, new { @class = "GroupDetailClik CustomerPaymentsChange" })</td>
                            <td class="GroupDetailClik" width="30%;">@Html.TextBoxFor(model => model.Rows[ind].Description, new { @class = "table_inputs_266 table_inputs_WithoutBox GroupDetailClik FSizeForGroupTable CustomerPaymentsChange ElementsForValidation MaxLength30" })</td>
                            <td class="GroupDetailClik" width="10%;">@Html.LabelForModel(Model.Rows[ind].Debit, new { @class = "table_inputs_82 GroupDetailClik FSizeForGroupTable", @style = "text-align: left" })</td>
                            <td class="GroupDetailClik" width="10%;">@Html.LabelForModel(Model.Rows[ind].Credit, new { @class = "table_inputs_82 GroupDetailClik FSizeForGroupTable", @style = "text-align: left" })</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
    <div style="width: 941px; height: 110px; margin-left: 9px; float: left; padding-top: 10px" id="PaymentSaveCloseAddNewPaymentBtns">
        @if(Model.MenuManageCustomerEdit)
        { 
            <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" id="CustomerPaymentsSaveBtn">Save</button>
            <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" onclick="$('#cboxClose').click()">Cancel</button>
            <button class="btn14 btn130" style="float: right; margin-right: 15px; " type="button" onclick="AddNewPaymentShow()">Add New Payment</button>
        }
        else
        {
            <button class="btn14 btn50 disabled" style="float: right; margin-right: 15px; " type="button" disabled="disabled" id="CustomerPaymentsSaveBtn">Save</button>
            <button class="btn14 btn50" style="float: right; margin-right: 15px; " type="button" onclick="$('#cboxClose').click()">Cancel</button>
            <button class="btn14 btn130 disabled" style="float: right; margin-right: 15px; " type="button" disabled="disabled" onclick="AddNewPaymentShow()">Add New Payment</button>
        }
       
    </div>
}
@using (@Html.BeginForm("SaveCustomerPaymentsData", "Customer", FormMethod.Post, new { id = "LoadCustomerAddPaymentsForm", @style = "height:0px;margin-top: 130px;" }))
{
    <div id="AddPaymentDiv" style="height: 110px; float: left; display: none; ">
        <div id="ErrorMessagesDivPopUp">
            <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
            @if (Model.Message != null)
            {
                @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
            }
        </div>
        <div style="width: 941px; margin-left: 9px; float:left">
            <table class="table table-bordered table-hover table-condensed" style="width: 920px; table-layout: fixed; background-color: white;">
                <tbody>
                    <tr>
                        <td width="10%;">@Html.TextBoxFor(model => model.PaymentDate, new { @class = "table_inputs_82 table_inputs_WithoutBox CustomerDeteilsDataCalendar FSizeForGroupTable ElementsForValidation CustomerPaymentDate AddCustomerPaymentsElementChange Date Required", @style = "cursor:pointer" })</td>
                        <td width="30%;">
                            @Html.DropDownListFor(model => Model.AddPayTypeIDSelected, new SelectList(Model.PaymentTypes, "Value", "Text"), new { @class = "table_inputs_266 table_inputs_WithoutBox FSizeForGroupTable AddCustomerPaymentsElementChange PaymentDrop CustomerPaymentAddPayTypeID" })
                        </td>
                        <td width="10%;" style="text-align:center">@Html.CheckBoxFor(model => model.RefundF, new { @class = "CustomerPaymentRefundF AddCustomerPaymentsElementChange" })</td>
                        <td width="30%;">@Html.TextBoxFor(model => model.Description, new { @class = "table_inputs_266 table_inputs_WithoutBox CustomerPaymentDescription FSizeForGroupTable ElementsForValidation AddCustomerPaymentsElementChange MaxLength30" })</td>
                        <td width="10%;">@Html.LabelForModel(Model.Debit, new { @class = "table_inputs_82 FSizeForGroupTable", @style = "text-align: left" })</td>
                        <td width="10%;">@Html.LabelForModel(Model.Credit, new { @class = "table_inputs_82 FSizeForGroupTable", @style = "text-align: left" })</td>
                    </tr>
                </tbody>
            </table>
            <div style="float: right;margin-right:21px;">
                <button class="btn14 btn50" type="button" onclick="AddNewPaymentsClose()">Cancel</button>
                @if(Model.MenuManageCustomerEdit)
                { 
                    <button class="btn14 btn50" type="button" id="AddCustomerPaymentsBtn">Save</button>
                }
                else
                {
                    <button class="btn14 btn50 disabled" type="button" disabled="disabled" id="AddCustomerPaymentsBtn">Save</button>
                }
            </div>
        </div>
    </div>

}
<div id="CustomerPaymentDetDiv" style="width: 941px; margin-left: 9px; float: left"></div>
    

